<?php
class Engine_Form_Element_Select extends Engine_Form_Element {

    protected $options = array();

    public function setOptions(array $options) {
        $this->options = $options;
    } 

    public function compile() {
        $result = '<select ' . $this->renderAttribs() . ' >'."\r\n";
        $options = $this->options;
        if (is_array($options)) {
            foreach ($options as $value => $option) {
                $option = array_values($option);
                $result .= '<option value="' . $option[0] . '" ' . ($option[0] === $this->value ? 'selected' : '') . '>' . $option[1] . '</option>' . "\r\n";
            }
        }
        $result .= '</select>'."\r\n";
        return $result;
    }

    public function populate($value) {
        $this->setValue($value);
    }

}